var path = require('path')

var htmlWebpackPlugin = require('html-webpack-plugin')

var vueLoaderPlugin = require('vue-loader/lib/plugin')

module.exports = {
	entry: path.resolve(__dirname,'src/main.js'),
	output: {
		path: path.resolve(__dirname,'dist'),
		filename: 'bundle.js'
	},
	plugins:[
		new htmlWebpackPlugin({
			template:path.resolve(__dirname,'src/index.html'),
			filename:'index.html'
		}),
		new vueLoaderPlugin()
	],
	module:{
		rules:[
			{ test:/\.css$/, use: [ 'style-loader','css-loader' ] },
			{ test:/\.scss$/, use: [ 'style-loader','css-loader','sass-loader' ] },
			{ test: /\.(png|jpg|gif|ttf)$/, use: 'url-loader' },
			{ test:/\.js$/, use: 'babel-loader', exclude:/node_modules/ },
			{ test:/\.vue$/, use: 'vue-loader' }
		]
	},
	performance: {
	    hints: "warning", // 枚举
	    maxAssetSize: 30000000, // 整数类型（以字节为单位）
	    maxEntrypointSize: 50000000, // 整数类型（以字节为单位）
	    assetFilter: function(assetFilename) {
	    	// 提供资源文件名的断言函数
	    	return assetFilename.endsWith('.css') || assetFilename.endsWith('.js');
	    
	    }
	},
}